{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "e8361d03-3ded-4f06-8ffe-2ca3e8af9e2e",
   "metadata": {},
   "source": [
    "https://leetcode.com/problems/search-a-2d-matrix\n",
    "\n",
    "\n",
    "Runtime: 0 ms, faster than 100.00% of C++ online submissions for Search a 2D Matrix.\n",
    "Memory Usage: 9.5 MB, less than 77.32% of C++ online submissions for Search a 2D Matrix.\n",
    "\n",
    "\n",
    "```cpp\n",
    "#include <bits/stdc++.h>\n",
    "\n",
    "using namespace std;\n",
    "\n",
    "class Solution {\n",
    "public:\n",
    "    bool searchMatrix(vector<vector<int>>& matrix, int target) {\n",
    "      //7:02\n",
    "      for (int i = 0; i < matrix.size() - 1; i++) {\n",
    "        if ((target >= matrix[i][0]) && target < matrix[i+1][0]) {\n",
    "          for (auto num : matrix[i]) {\n",
    "            if (num == target) {\n",
    "              return true;\n",
    "            }\n",
    "          }\n",
    "        }\n",
    "      }\n",
    "      for (auto num : matrix[matrix.size() - 1]) {\n",
    "            if (num == target) {\n",
    "              return true;\n",
    "            }\n",
    "      }\n",
    "      return false;\n",
    "      //7:03\n",
    "    }\n",
    "};\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "4b1659ad-ffc4-4615-be82-df2df6dafd7d",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "C++17",
   "language": "C++17",
   "name": "xcpp17"
  },
  "language_info": {
   "name": ""
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
